package com.stu;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class Test {
    public static void main(String[] args) {
        ObjectMapper objectMapper = new ObjectMapper();
        Dept dept = new Dept();
        dept.setAge(12);
        dept.setName("asd");
        try {
            String json = objectMapper.writeValueAsString(dept);
            System.out.println(json);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
    }
}
